package com.demo.controller;

import com.demo.domain.Person;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@RestController //@RestController=@Controller+@ResponseBody 官方推荐使用
public class WebController2 {

    //使用@RestController 返回的是json字符串，返回页面需要用ModelAndView
    @RequestMapping("/index2")
    public ModelAndView index(Model model){
        model.addAttribute("msg", "后台传的数据...");
        return new ModelAndView("index");
    }
}

